<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<title>炫列表</title>
<link rel="stylesheet" type="text/css" href="../../css/aui-win.css" />
<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
<script src="../../script/jquery-1.10.2.min.js"></script>
<script src="../../script/common.js"></script>
<style>
			.xuanNav {
				height: 50px;
			}
			.xuanNav div {
				width: 12%;
				height: 40px;
				float: left;
				margin-left: 7%;
				line-height: 40px;
				border: 1px solid orange;
				border-radius: 50%;
				text-align: center;
			}
			.xuanNav div a {
				text-decoration: none;
				color: black;
			}
			.xuanNav div .noSelecteds {
				color: orange;
			}
			.selected {
				background: orange;
			}
			/*重新定义
			 .aui-list-view:after {
			 border-top: 0;
			 }
			 .aui-list-view:before {
			 border-top: 0;
			 }
			 .aui-user-view-cell:after {
			 left: 0;
			 }*/
			a {
				display: block;
			}
			/*自定义*/
			.colorBlue {
				color: #00ABFD;
			}
			.content {
				font-size: 14px;
				color: #333333;
			}
			.otherinfo span {
				font-size: 16px;
				position:relative;
				bottom:2px;
				margin:0px 2px;
			}
			.icon {
				margin-left: 10px;
			}
			.h10 {
				height: 10px;
			}
			.warnLi{
				width:100%;
				height:300px;
				text-align:center;
			}
			.warnLi span{
				margin-top:140px;
				font-size:20px;
			}
		</style>
</head>
<body>
<div id="tanChu1">
	<p>数据请求失败！</p>
	<input type="button" value="确定" id="tanChu_btn1">
</div>
<header class="aui-bar aui-bar-nav aui-bar-yunzo" id="aui-header">
		<a class="aui-btn aui-bar-yunzo aui-pull-left" id="back"> <span class="aui-iconfont aui-icon-left"></span> </a>
		<div class="aui-title" id="title">
			炫
		</div>
		<a class="aui-iconfont aui-icon-menu aui-pull-right" onclick="publish()"><img src="../../image/my/publish.png" alt=""></a>
</header>
<div class="h10" ></div>
<div class="aui-content-padded">
		<ul id="txtNewsList"></ul>
</div>
<!--加载loading功能-->
<div id="loadIng_startStop" style="width: 100%;height: 100%;position: absolute;z-index: 1000;display: none;">
    <div class="div_loding_img">
		数据加载中
	</div>
</div>
<script type="text/javascript">

    /*loading加载转圈*/
    sTart_Stop();

//显示数据条数
var pagesize = 5;
//当前数量
var curCount = 0;
//显示内容
var objcontent;
//瀏覽數
var browsCunts;
//傳遞參數數組
var listDataArr;
//傳遞參數
var param;
var did;
$(document).ready(function(){
	goback("../main.html");
	objcontent = $('#txtNewsList');
	did=initdata.get('showmeinfo');
	param=basedata('showmeinfo')+ '&type=0&pagesize=' + pagesize + '&curCount=' + curCount;
	getListData(param);
});
function getListData(post)
{
	ajaxcocRequest("../../../api/group/getshowmeinfobygidlist", "POST", post,function(msg){
		if(msg.code==100)
		{
			var len = msg.data.length;
			listDataArr = new Array();
			browsCunts = new Array();
			curCount = curCount + len;
			var html = '';					
				for (var i = 0; i < len; i++) {
					var thisItem = msg.data[i];
					
					listDataArr[i] = [thisItem.n0,thisItem.n1,thisItem.n2,thisItem.n6,thisItem.n3,thisItem.n4,thisItem.n5,thisItem.n12];						
					browsCunts[i] = [thisItem.n14];
					html += '<li class="aui-list-view">';
					html += '<a tapmode="active" onclick="openNews(listDataArr,'+i+')"><div class="aui-user-view-cell aui-img">';
					html += '<img class="aui-img-object aui-pull-left" src="' + thisItem.n1 + '">';
					html += '<div class="aui-img-body">';
					html += '<span>' + thisItem.n2 + '<em class="colorBlue">' + thisItem.n6 + '</em><em>关注热度</em></span>';
					html += '<p class="aui-ellipsis-1">' + thisItem.n3 + '</p>';
					html += '</div></div>';
					html += '<div class="aui-padded-10 content">' + thisItem.n4 + '</div>';
					html += '<ul class="aui-thumb-view" >';
					for (var j = 0; j < thisItem.n5.split(',').length; j++) {
						if(thisItem.n5.split(',')[j]!=null){
							html += '<li class="aui-list-view-cell aui-img aui-col-xs-4" ><img class="aui-img-object" src="' + thisItem.n5.split(',')[j] + '"></li>';
						}
					}
					var zanSrc, careSrc;
					if (thisItem.n8 == 1) {
						zanSrc = "../../image/home/busess/noPraiseIcon.png";
					} else {
						zanSrc = "../../image/home/busess/PraiseIcon.png";
					}
					if (thisItem.n9 == 1) {
						careSrc = "../../image/home/busess/noCollect.png";
					} else {
						careSrc = "../../image/home/busess/collectIcon.png";
					}
					html += '</a></ul>';
					//html += '<div class="aui-line-x"></div>';
					html += '<div id="' + thisItem.n0 + '" class="aui-col-xs-12  otherinfo">';
					html += '<div style="float:right;right:10%;height:50px;line-height:50px;">';
					html += '<img class="icon" src="../../image/home/busess/browseIcon.png"><span>'+thisItem.n14+'</span>';
					html += '<img class="icon" src="' + careSrc + '" onclick="careUp(\'' + thisItem.n0 + '\',\'' + thisItem.n12 + '\',\'' + thisItem.n9 + '\',\'' + i + '\')"><span>'+thisItem.n11+'</span>';
					html += '<img class="icon" src="' + zanSrc + '" onclick="thumbUp(\'' + thisItem.n0 + '\',\'' + thisItem.n12 + '\',\''+ thisItem.n8 + '\',\'' + i + '\')"><span>'+thisItem.n7+'</span>';
					html += '<img class="icon" onclick="openNewse(this,\'' + thisItem.n0 + '\', \'' + did + '\')" src="../../image/home/busess/commentIcon.png"><span>'+thisItem.n10+'</span>';
					html += '</div></div><div class="aui-line-x"></div>';
					html += '</div></li>';
				}
				objcontent.append(html);

			} else {					
				refresh_failure();
			}
			
		});
}
/**
 * 发布炫
 */
function publish()
{
	if (($myname != undefined) && ($myheadimg != undefined) && ($mysex != undefined)) {
		window.location="showme_publish.html";
	} else {
		window.location="showme_publish_editmyinfo.html";
	}
}
/**
 * 打开炫详情
 */
function openNews(darr,i) {
	window.location="showme_info.html?"+encodeURIComponent("showid="+darr[i][0]+"&img="+darr[i][1]+"&name="+darr[i][2]+"&cares="+darr[i][3]+"&time="+darr[i][4]+"&title="+darr[i][5]+"&content="+darr[i][6]+"&tomid="+darr[i][7]);
}

//用户关注函数
function careUp(pid, tomid, iscare, i) {
if($mtype=="guest")
		{
			alert("游客模式无权限使用[关注]功能！");
		}else{
	ajaxCoCRequest('api/attentiontomid?mid=' + mid + '&did=' + did + '&groupid=' + groupid + '&pid=' + pid + '&tomid=' + tomid + '&type=' + (iscare == 1 ? 0 : 1), 'POST', '', function(ret, err) {
		if (ret.code==100) {
				toast((iscare == 1 ? "关注成功!" : "取消关注!"));
				loadaction(pid, tomid, i)

		} else {
			api.alert({
				title : "数据请求错误",
				msg : err.msg
			});
		}
	});
}}

//用户点赞函数
function thumbUp(pid,tomid,iscare,i) {
		ajaxCoCRequest('api/userproetformid?mid=' + mid + '&did=' + did + '&groupid=' + groupid + '&pid=' + pid + '&type=' + (iscare == 1 ? 0 : 1), 'POST', '', function(ret, err) {
			if (ret.code==100) {
				toast((iscare == 1 ? "点赞成功!" : "取消点赞!"));
				loadaction(pid, tomid, i);
			} else {
				toast(err.msg != null ? err.msg : "请求数据为空");
			}
		});
	
}
//操作数据更新
function loadaction(showid, tomid, i) {
	ajaxCoCRequest('api/group/getshowmeinfobyAction?mid=' + mid + '&did=' + did + '&groupid=' + groupid + '&showid=' + showid, 'POST', '', function(ret, err) {
		if (ret) {
			var thisItem = ret.datum;
			var zanSrc, careSrc;
			if (thisItem.n2 == 1) {
				zanSrc = "../../image/home/busess/noPraiseIcon.png"
			} else {
				zanSrc = "../../image/home/busess/PraiseIcon.png"
			}
			if (thisItem.n3 == 1) {
				careSrc = "../../image/home/busess/noCollect.png"
			} else {
				careSrc = "../../image/home/busess/collectIcon.png"
			}
			$api.byId(showid).innerHTML = '';
			var html = '';
			html += '<div style="float:right;right:5%;height:50px;line-height:50px;">';
			html+= '<img src="../../image/home/busess/browseIcon.png"><span>'+browsCunts[i]+'</span>'
			html += '<img class="icon" src="' + careSrc + '" onclick="careUp(\'' + showid + '\',\'' + tomid + '\',\'' + thisItem.n3 + '\',\'' + i + '\')"><span>'+thisItem.n5+'</span>';
			html += '<img class="icon" src="' + zanSrc + '" onclick="thumbUp(\'' + showid + '\',\'' + tomid + '\',\'' + thisItem.n2+ '\',\'' + i + '\')"><span>'+thisItem.n1+'</span>';
			html += '<img class="icon" onclick="openNewse(\'' + showid + '\', \'' + did + '\')" src="../../image/home/busess/commentIcon.png"><span>'+thisItem.n4+'</span>';
			html += '</div></div>'
			$api.html($api.byId(showid), html);
		} else {
			toast(err.msg != null ? err.msg : "请求数据为空");
		}
	})
}
function openNewse()
{
}
</script>
</body>
</html>